﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace CNFM_CROCODILE_LOGO.Data.Migrations
{
    public partial class Model3 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "Telephone",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50);

            migrationBuilder.AlterColumn<string>(
                name: "Person",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50);

            migrationBuilder.AlterColumn<string>(
                name: "Address",
                table: "Enterprise",
                unicode: false,
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 200);

            migrationBuilder.AddColumn<string>(
                name: "ApprovedDepartment",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "ApprovedName",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "ApprovedSum",
                table: "Enterprise",
                type: "int",
                unicode: false,
                nullable: true,
                defaultValue: 0);

            migrationBuilder.AddColumn<DateTime>(
                name: "JYEndDate",
                table: "Enterprise",
                type: "datetime",
                unicode: false,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "JYLicense",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "JYStartDate",
                table: "Enterprise",
                type: "datetime",
                unicode: false,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "LegalPerson",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "UserId",
                table: "Enterprise",
                unicode: false,
                maxLength: 36,
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "XYEndDate",
                table: "Enterprise",
                type: "datetime",
                unicode: false,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "XYLicense",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "XYStartDate",
                table: "Enterprise",
                type: "datetime",
                unicode: false,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "ZipCode",
                table: "Enterprise",
                unicode: false,
                maxLength: 20,
                nullable: true);            

            migrationBuilder.CreateTable(
                name: "Enterprises",
                columns: table => new
                {
                    Id = table.Column<string>(unicode: false, maxLength: 36, nullable: false),
                    Remarks = table.Column<string>(unicode: false, maxLength: 200, nullable: true),
                    Status = table.Column<int>(type: "int", unicode: false, nullable: false, defaultValue: 0),
                    CreateTime = table.Column<DateTime>(type: "datetime", nullable: false, defaultValueSql: "(getdate())"),
                    CreateId = table.Column<string>(unicode: false, maxLength: 50, nullable: false),
                    EnterprisesId = table.Column<string>(unicode: false, maxLength: 36, nullable: true),
                    Name = table.Column<string>(unicode: false, maxLength: 50, nullable: true),
                    Province = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    City = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    Area = table.Column<string>(unicode: false, maxLength: 20, nullable: true),
                    Address = table.Column<string>(unicode: false, maxLength: 200, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Enterprises", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Enterprises");

            migrationBuilder.DropColumn(
                name: "ApprovedDepartment",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "ApprovedName",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "ApprovedSum",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "JYEndDate",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "JYLicense",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "JYStartDate",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "LegalPerson",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "UserId",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "XYEndDate",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "XYLicense",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "XYStartDate",
                table: "Enterprise");

            migrationBuilder.DropColumn(
                name: "ZipCode",
                table: "Enterprise");
         

            migrationBuilder.AlterColumn<string>(
                name: "Telephone",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "Person",
                table: "Enterprise",
                unicode: false,
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 50,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "Address",
                table: "Enterprise",
                unicode: false,
                maxLength: 200,
                nullable: false,
                oldClrType: typeof(string),
                oldUnicode: false,
                oldMaxLength: 200,
                oldNullable: true);
        }
    }
}
